import * as service from "@/service";
import { Ininelist } from "./interface";

const ninelist: Ininelist = {
  namespaced: true,
  state: {
    list: [],
    list_header: [],
  },
  actions: {
    async getNineList({ commit }, { params }) {
      const result = await service.fetchNineList(params);
      console.log(result);
      commit({
        type: "GET_NINELIST",
        payload: result?.data?.lists,
      });
    },
    async getHeaderList({ commit }) {
      const result = await service.fetchNineList1();
      console.log(result);
      commit({
        type: "GET_HEADERLIST",
        payload: result?.data?.goodsList,
      });
    },
  },
  mutations: {
    GET_NINELIST(state, { payload }) {
      state.list = payload;
      console.log(state.list);
    },
    GET_HEADERLIST(state, { payload }) {
      state.list_header = payload;
    },
  },
};

export default ninelist;
